import cn.kgc.factory.ProxyFactory;
import cn.kgc.service.IUserService;
import cn.kgc.service.impl.UserService;
import org.junit.Test;

/**
 * @author Rock
 * @create 2020-08-25 23:20
 */
public class test01 {

    @Test
    public void test01() {
        // 创建目标对象
        UserService target = new UserService();
        System.out.println(target.getClass());
        // 创建代理对象
        IUserService proxy = (IUserService) new ProxyFactory(target).createProxyInstance();
        System.out.println(proxy.getClass());
        // 使用代理对象调用方法
        proxy.insertUser();
        String s = proxy.deleteUser(1);
        System.out.println(s);
    }
}
